PEP 405 – Python Virtual Environments
Motivation
The utility of Python virtual environments has already been well established by the popularity of existing third-party virtual-environment tools, primarily Ian Bicking’s virtualenv. Specification
f a pyvenv.cfg file is found either adjacent to the Python executable or one directory above it (if the executable is a symlink, it is not dereferenced), this file is scanned for lines of the form key = value.
If a home key is found, this signifies that the Python binary belongs to a virtual environment, and the value of the home key is the directory containing the Python executable used to create this virtual environment.
sys.base_prefix is set to this value (※home keyの指すvalue), while sys.prefix is set to the directory containing pyvenv.cfg.
Isolation from system site-packages
If the pyvenv.cfg file also contains a key include-system-site-packages with a value of true (not case sensitive), the site module will also add the system site directories to sys.path after the virtual environment site directories.
Creating virtual environments
Sysconfig install schemes and user-site
Copies versus symlinks
Include files
API